#ifndef COLLECTPREDEFINATIONTHREAD_H
#define COLLECTPREDEFINATIONTHREAD_H

#include <QThread>
#include <QList>
#include <QSettings>
#include <QHash>
#include <QStringList>

class CollectPredefinationThread : public QThread
{
    Q_OBJECT
public:
    explicit CollectPredefinationThread(const QString &dir = "", QObject *parent = 0);
    ~CollectPredefinationThread();

    QStringList getFactoryList() const;
    void getDeviceList (const QString &,QStringList &, QList<QSettings *> &) const;

    enum ErrorType {
	ERR_DIR_NOT_FOUND
    };

    void startCollect();
    void stopCollect();

    void clear();

signals:
    void collectFinish();
    void collectError(int,QString);

protected:
    void run ();

private:
    QStringList m_foundFactoryList;
    QHash <QString, QStringList> m_foundDeviceList;
    QHash <QString, QList<QSettings *> > m_foundDeviceInfo;

    QString m_dir;
    bool m_requireStop;
};

#endif // COLLECTPREDEFINATIONTHREAD_H
